{% extends base.html %}

{% block head %}

<style>
    .td-no {
        width: 50px;
    }
</style>

{% end %}

{% block body %}

{% set title = "用户管理" %}
{% include "tools/base_title.html" %}

<div class="col-md-12">&nbsp;</div>

<form method="POST">
<table class="table col-md-12">

    <tr>
        <th class="td-no">编号</th>
        <th>用户名</th>
        <th>密码</th>
        <th>上次更新</th>
        <th>token</th>
        <th>操作</th>
    </tr>
    
    {% set index = -1 %}
    {% for index, name in enumerate(sorted(user_dict)) %}
    {% set user = user_dict[name] %}
    <tr>
        <td class="td-no">{{index+1}}</td>
        <td>{{user.name}}</td>
        <td>{% if "admin" == user.name %} ****** {% else %} {{user.password}} {% end %}</td>
        <td>{{ user.get("mtime") }}</td>
        <td>{{ user.get("token") }}</td>
        <td></td>
    </tr>
    {% end %}

    <tr>
        <td>{{index+2}}</td>
        <td><input type="text" name="name"></td>
        <td><input type="text" name="password"></td>
        <td></td>
        <td></td>
        <td><input type="submit" value="添加/更新"></td>
    </tr>
</table>
</form>

{% end %}